package com.example.myFirstProject.service.impl;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.example.myFirstProject.entity.Role;
import com.example.myFirstProject.mapper.RoleMapper;
import com.example.myFirstProject.service.RoleService;

@Service
@Transactional
public class RoleServiceImpl implements RoleService{

	@Autowired
	private RoleMapper roleMapper;
	
	private List<Role> list;
	
	private Role role;
	
	public int insertRole(Role role) {
		return roleMapper.insertRole(role);
	}

	public int deleteRole(Integer rid) {
		return roleMapper.deleteRole(rid);
	}

	public int updateRole(Role role) {
		return roleMapper.updateRole(role);
	}

	public List<Role> selectRole() {
		list = new ArrayList<Role>();
		list = roleMapper.selectRole();
		return list;
	}

	@Override
	public Role selectOneRole(Integer rid) {

		role= new Role();
		role= roleMapper.selectOneRole(rid);
		return role;
	}

	
}
